<template>
	<view class="content">
		<template v-if="daojuList.length > 0">
			<view class="kapian_big_box" v-for="(item, index) in daojuList" :key="index">
				<image v-if="item.type == 1"
					src="https://mh.qingfentool.vip/upload/image/20230523/6d939386eee9be04078b9788f2dd03f6.png" mode="">
				</image>
				<image v-if="item.type == 2"
					src="https://new.qingfentool.vip/upload/image/20230713/5fb4f37c8ffe5e59dbd5ac883847bf52.png" mode="">
				</image>
				<view class="chakan_box" @tap="gochakan(item)">
					点击查看
				</view>
				<!-- <view class="big_txt_box">
					{{item.card_name}}
				</view> -->
				<view class="gongyou_txt">
					共有{{ item.counter }}张
				</view>
				<view class="bot_txt">
					{{ item.desc }}
				</view>
			</view>
		</template>
		<!-- 无道具 -->
		<template v-else>
			<view class="kapian_big_box">
				<image src="https://mh.qingfentool.vip/upload/image/20230523/6d939386eee9be04078b9788f2dd03f6.png" mode="">
				</image>
				<view class="chakan_box" @tap="gochakan">
					点击查看
				</view>
				<!-- <view class="big_txt_box">
					反悔卡
				</view> -->
				<view class="gongyou_txt">
					共有0张
				</view>
				<view class="bot_txt">
					可重新抽取盲盒一次
				</view>
			</view>
			<view class="kapian_big_box">
				<image src="https://new.qingfentool.vip/upload/image/20230713/5fb4f37c8ffe5e59dbd5ac883847bf52.png" mode="">
				</image>
				<view class="chakan_box" @tap="gochakan">
					点击查看
				</view>
				<!-- <view class="big_txt_box">
					反悔卡
				</view> -->
				<view class="gongyou_txt">
					共有0张
				</view>
				<view class="bot_txt">
					加倍令可用于199价格以下的盲盒使用
				</view>
			</view>
		</template>
		<!-- <view class="xiaoliangg">
			<view class="top_box">
				<view class="left_txt">
					精选盲盒
				</view>
				<view class="right_txt" @tap="gohome">
					查看更多
				</view>
			</view>
			<view class="bot_box">
				<view class="one_box" v-for="(item,index) in daojubotList" :key="index" @tap="tujaBtn(item.box_id,item.cat_id)">
					<view class="one_img">
						<image :src="item.cover_pic" mode=""></image>
					</view>
					<view class="one_txt">
						{{item.name}}
					</view>
				</view>
			</view>

		</view> -->
	</view>
</template>

<script>
export default {
	props: {
		flag: {
			type: Boolean,
			default: false
		},
		avative: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			daojuList: [],
			daojubotList: [],
		}
	},
	onShow() {
		this.fanhui()
		this.xlzg()
	},
	methods: {
		tujaBtn(boxId, catId) {
			uni.navigateTo({
				url: '/rollPages/index/swiperIndex?box_type=' + this.catId + '&box_id=' + boxId +
					'&type=&play=' + 8
			})
		},

		xlzg() {
			this.$Request.get(this.$api.user.getTopSale).then(res => {
				////console.log(res.data.box_list,"销量最高")
				this.daojubotList = res.data.box_list
			})
		},
		gohome() {
			// 去首页
			uni.switchTab({
				url: '/pages/index/redouble'
			})
		},
		gochakan(item) {
			uni.navigateTo({
				url: '/userPage/user/weidao/index?type=' + item.type
			});
		},

		fanhui() {
			//前端数据请求时，显示加载提示弹框
			uni.showLoading({
				title: '加载中...'
			});
			this.$Request.get(this.$api.user.getCardList).then(res => {
				////console.log(res, "道具")
				this.daojuList = res.data
				uni.hideLoading(); // 数据从后端接口返回后，提示弹框关闭
				// uni.navigateTo({
				// 	url: '/rollPages/index/index?order_id=' + res.data.order_id + '&box_id=' +
				// 		this.box_id + '&type=' + e.tabIndex
				// })
			})

		}
	}
}
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	min-height: 100vh;
	background: #262626;

	.kapian_big_box {
		height: 256rpx;
		width: 94%;
		position: relative;
		margin: auto;
		margin-bottom: 20rpx;

		image {
			width: 100%;
			height: 100%;
			// margin-top: 23rpx;
		}

		.chakan_box {
			font-size: 28rpx;
			line-height: 60rpx;
			text-align: center;
			color: #fff;
			background-color: #7C3C00;
			position: absolute;
			width: 162rpx;
			height: 60rpx;
			right: 28rpx;
			bottom: 0;
			top: 0;
			margin: auto;
			border-radius: 16rpx;
		}

		.big_txt_box {
			position: absolute;
			left: 26rpx;
			top: 32rpx;
			width: 256rpx;
			height: 110rpx;
			color: #9076FF;
			font-weight: 900;
			font-size: 80rpx;
			line-height: 110rpx;
			text-align: center;
		}

		.gongyou_txt {
			position: absolute;
			left: 282rpx;
			top: 170rpx;
			width: 150rpx;
			height: 40rpx;
			text-align: center;
			line-height: 40rpx;
			color: #FFFFFF;
			font-size: 20rpx;
		}

		.bot_txt {
			width: 400rpx;
			height: 30rpx;
			line-height: 30rpx;
			color: #fff;
			font-size: 20rpx;
			position: absolute;
			text-align: center;
			left: 0;
			right: 0;
			margin: auto;
			bottom: 10rpx;
		}
	}

	.wudaoju_box {
		width: 500rpx;
		height: 400rpx;
		margin: auto;

		image {
			width: 100%;
			margin-top: 150rpx;
			height: 100%;
		}
	}

	.xiaoliangg {
		width: 94%;
		height: 270rpx;
		background: linear-gradient(135deg, #FFAEAE 0%, #FFB07E 100%);
		box-shadow: 0rpx 2rpx 10rpx 0rpx rgba(0, 0, 0, 0.05);
		border-radius: 14rpx;
		position: absolute;
		bottom: 50rpx;
		left: 50%;
		transform: translate(-50%);

		.top_box {
			width: 100%;
			height: 40rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 10rpx 0 10rpx;

			.left_txt {
				font-size: 28rpx;
				color: #ffffff;
				font-weight: 700;
				width: 30%;
				height: 100%;
				padding-top: 10rpx;
				line-height: 40rpx;
			}

			.right_txt {
				font-size: 24rpx;
				color: #ffffff;
				font-weight: 700;
				width: 15%;
				height: 100%;
				padding-top: 10rpx;
				line-height: 40rpx;
			}
		}

		.bot_box {
			width: 100%;
			height: 200rpx;
			display: flex;
			justify-content: space-around;

			.one_box {
				width: 24%;
				height: 200rpx;
				// background-color: #fff;

				.one_img {
					width: 166rpx;
					height: 183rpx;
					// background-color: red;
					margin: auto;
					margin-top: 10rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.one_txt {
					text-align: center;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					width: 100%;
					height: 40rpx;
					line-height: 4rpx;
					font-size: 16rpx;
					color: #FFFFFF;
				}
			}
		}
	}
}</style>
